import Square from '../render/Square';

export default function makeSquare(canvas,square, gridX, gridY, y) {
  let group = {};
  let { w, h } = square;
  let conX = canvas.width / 2;
  group.w = gridX * w;
  group.h = gridY * h;
  group.x = conX - group.w / 2;
  group.y = y;

  let groupArr = [];
  let colorList = ['#FFCCAA','#DCB5AC','#A9EB48','#B5B56C','#3AF9F9','#9FB1B6','#10B5DE','#F031F0','#F076D7','#FA5B9A'];
  for (let i = 0; i < gridX; i++) {
    for (let j = 0; j < gridY; j++) {
      let item = new Square();
      item.x = (i * group.w / gridX)+group.x;
      item.y = (j * group.h / gridY)+group.y;
      // item.color = colorList[Math.round(Math.random()*(colorList.length-1))];
      item.color = colorList[j];
      groupArr.push(item);
    }
  }
  return groupArr;
}